package tjs.study.notes.dotest.jvm.classload.agent.impl;

import sun.misc.CompoundEnumeration;

import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;

public class PluginClassLoader extends ClassIsolationLoader {
    private String pluginName;

    public PluginClassLoader(Object plugin) {
        super(null, null);
        this.includePackages.add("com.shsnc.ng.agent.container");
    }

    @Override
    public Enumeration<URL> getResources(String name) throws IOException {
        // 解决类加载扫描只扫自身的类，不扫描父加载器的类
        Enumeration<URL>[] tmp = new Enumeration[]{findResources(name)}; // 解决类加载扫描只扫自身的类，不扫描父加载器的类
        return new CompoundEnumeration<URL>(tmp);
    }
}